====== Installation et Configuration de jabberd2 -- DRAFT ======



===== Prérequis =====
Pour garder les informations liées aux utilisateurs, vous devez avoir un serveur de base de donnée installé ([[applications:postgresql:postgresql|postgre]], [[applications:mysql:faq_mysql|mysql]]...).

Cette façon de procéder doit marcher pour dapper et edgy (il y a de forte chance que ce soit toujours valable pour feisty).

===== Installation du package jabberd2 ======

  sudo apt-get update
  sudo apt-get install jabberd2

Vous pouvez également utiliser Synaptic.


===== Configuration =====

==== Nom du serveur dans sm.xml et c2s.xml ====

Votre nom de serveur doit être renseigné à la fois dans ''sm.xml'' et dans ''c2s.xml''.

Editez ''sm.xml'' :
  gksudo gedit /etc/jabberd2/sm.xml

Renseignez le champ ''id'' de la section ''sm'' (~ ligne 1) :
<code xml>
  <!-- Session manager configuration -->
  <sm>
    <!-- Our ID on the network. Users will have this as the domain part of
         their JID. If you want your server to be accessible from other
         Jabber servers, this ID must be resolvable by DNS.s
         (default: localhost) -->
    <id>ma_machine.mon_domaine.com</id>    
</code>

Editez ''c2s.xml'' :
  gksudo gedit /etc/jabberd2/c2s.xml

Renseignez le champ ''id'' de la section ''local'' (~ ligne 63) :
<code xml>
  <!-- Local network configuration -->
  <local>
    <!-- Who we identify ourselves as. This should correspond to the
         ID (host) that the session manager thinks it is. You can
         specify more than one to support virtual hosts, as long as you
         have additional session manager instances on the network to
         handle those hosts. The realm attribute specifies the auth/reg
         or SASL authentication realm for the host. If the attribute is
         not specified, the realm will be selected by the SASL
         mechanism, or will be the same as the ID itself. Be aware that
         users are assigned to a realm, not a host, so two hosts in the
         same realm will have the same users.
         If no realm is specified, it will be set to be the same as the
         ID. -->
    <id>ma_machine.mon_domaine.com</id>
</code>        

Comme il est mentionné dans le fichier ''c2s.xml'', le nom du serveur (qui est concaténé à l'id jabber) doit pouvoir être résolu par DNS (ou via ''/etc/hosts'')






==== Création de la base de données et configuration de jabberd2 ====
=== Postgresql ===

Dans un terminal :
  sudo su postgres
  createdb jabberd2
  createuser -SDRP jabberd2
  psql template1

Dans la session ''psql'' :
  jabberd2=>\i /usr/share/doc/jabberd2/db-setup.pgsql
  jabberd2=>\q
N'oubliez pas de vous déconnecter de la session ''postgres'' :
  exit

Editez ''sm.xml'' et dans la section ''Storage database configuration'', renseignez le champ ''driver'' avec ''pgsql'' (PostgreSQL) :

  gksudo gedit /etc/jabberd2/sm.xml

<code xml>
  <!-- Storage database configuration -->
  <storage>
    <!-- By default, we use the MySQL driver for all storage -->
    <driver>pgsql</driver>   
</code>

Toujours dans ''sm.xml'' dans la section ''PostgreSQL driver configuration'', remplacer ''secret'' avec le mot de passe de l'utilisateur ''jabberd2'' de PostgreSQL. Changez le nom de l'utilisateur et/ou de la base si vous n'utilisez pas ceux par défaut  (''jabberd2'' et ''jabberd2'') :

<code xml>
  <!-- PostgreSQL driver configuration -->
  <pgsql>
    <!-- Database server host and port -->
    <host>localhost</host>
    <port>5432</port>

    <!-- Database name -->
    <dbname>jabberd2</dbname>

    <!-- Database username and password -->
    <user>jabberd2</user>
    <pass>secret</pass>

    <!-- Transaction support. If this is commented out, transactions
         will be disabled. This might make database accesses faster,
         but data may be lost if jabberd crashes. -->
    <transactions/>
  </pgsql>
</code>

Vous ne devez changer le champ ''host'' que si votre base de données ne se trouve pas sur la même machine que le serveur jabberd2.
Si vous n'utilisez pas le port par défaut de PostgreSQL (5432), vous devez modifier le champ ''port''.

Jabberd2 est maintenant configurer pour stocker ses informations dans une base PostgreSQL.

=== Mysql ===


===== Tests de l'installation =====



